package com.gis.visualization.controller;


import com.gis.visualization.config.result.R;
import com.gis.visualization.entity.EventType;
import com.gis.visualization.service.EventTypeService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author hqz
 * @since 2021-03-15
 */
@RestController
@RequestMapping("/visualization/eventtype")
public class EventTypeController {
    @Autowired
    private EventTypeService typeService;

    @ApiOperation("获取事件的类型")
    @GetMapping("getEventTypes")
    @Cacheable(value = "types",key = "'eventTypes'")
    public R getEventTypes() {
        List<EventType> eventTypes = typeService.list(null);
        return R.ok().data("eventTypes",eventTypes);
    }
}

